home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / pff1_3 / pff.bas < prev    next >
BASIC Source File  |  1995-05-09  |  4KB  |  102 lines

  1. Const FILEBOXCLICK = 0, DIRSBOXCLICK = 1
  2. Dim lastchange As Integer
  3.  
  4. Sub FormatFile (FileToFormat$)
  5.  
  6.         EOL$ = Chr$(13) + Chr$(10)
  7.         Footer$ = "      PFF - Programmer's File Formatter   Copyright 1989-91, AmSoft Development"
  8.         ReDim A$(110)
  9.         PageNum = 1
  10.         TotalLines = 0
  11.         Open FileToFormat$ For Input As #100 Len = 2048
  12.         plc = 1
  13.         While Not EOF(100)
  14.                 Header$ = "      Page -" + Str$(PageNum) + "    " + Date$ + Space$(20) + "    File: " + FileToFormat$
  15.                 Printer.FontName = "Courier 10 Pitch"
  16.                 Printer.FontSize = 12
  17.                 Printer.Print Header$
  18.                 For q = 1 To 2: Printer.Print : Next q
  19.                 Printer.FontName = "Courier 20 Pitch"
  20.                 Printer.FontSize = 6
  21.                 For plc = 1 To 108
  22.                         If EOF(100) GoTo EndOfFile
  23.                         Line Input #100, A$(plc)
  24.                         j% = Len(A$(plc))
  25.                         If j% = 1 And A$(plc) < " " Then
  26.                                 A$(plc) = " "
  27.                                 GoTo SendFF
  28.                         End If
  29.                         For count = 1 To j%
  30.                                 junk$ = Mid$(A$(plc), count, 1)
  31.                                 If junk$ = Chr$(12) Then
  32.                                         A$(plc) = Left$(A$(plc), count - 1)
  33.                                 End If
  34.                         Next count
  35.                 
  36. SendFF:
  37.  
  38.                         Printer.Print Space$(8);
  39.                         If LINES Then
  40.                                 Num$ = Space$(4 - Len(Str$(plc + (108 * (PageNum - 1))))) + Str$(plc + (108 * (PageNum - 1))) + "  "
  41.                                 Printer.Print Num$;
  42.                         End If
  43.                         A$(plc) = A$(plc)
  44.                         Printer.Print A$(plc)
  45.                         TotalLines = TotalLines + 1
  46.                 Next plc
  47.                 
  48. EndOfFile:
  49.  
  50.                 
  51.                 If Not EOF(100) Then
  52.                         Printer.FontName = "Courier 10 Pitch"
  53.                         Printer.FontSize = 12
  54.                         Printer.Print : Printer.Print Footer$
  55.                         Printer.NewPage
  56.                         PageNum = PageNum + 1
  57.                 Else
  58.                         For count = plc To 108
  59.                                 Printer.Print
  60.                         Next count
  61.                         Printer.FontName = "Courier 10 Pitch"
  62.                         Printer.FontSize = 12
  63.                         Printer.Print : Printer.Print : Printer.Print Footer$
  64.                         Printer.NewPage
  65.                 End If
  66.                 Wend
  67.                 Printer.EndDoc
  68.                 Close #100
  69.                 Close #200
  70.                 Erase A$
  71.         
  72. End Sub
  73.  
  74. Sub GetDefaults ()
  75.     On Error GoTo GD_ErrHandle             ' Turn on error handling
  76.     Open "callhelp.ini" For Input As #1    ' Open INI data file
  77.     Input #1, HelpFile$, KeyTable$         ' Read data into variables
  78.     Input #1, L%, T%                       ' Read data for location
  79.     Close #1                               ' Close data file
  80. '    Text1.Text = HelpFile$                 ' Set File Name box
  81. '    KwdTableBox.Text = KeyTable$           ' Set Multikey table box
  82.     Left = L%
  83.     Top = T%
  84.  
  85. GD_ErrHandle:
  86.     Selection.Caption = "No Help File"
  87.     Resume GD_Done
  88. GD_Done:
  89. End Sub
  90.  
  91. Sub Main ()
  92.  
  93.     Load About
  94.     About.Show MODAL
  95.     Load Selection
  96.     Load Viewer
  97.     LINES = True
  98.     Viewer.Display.Move 100, 446, Viewer.ScaleWidth - 200, Viewer.ScaleHeight - 546
  99.  
  100. End Sub
  101.  
  102.